package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.TbInvoiceRequestsMapper;
import com.ruoyi.system.domain.TbInvoiceRequests;
import com.ruoyi.system.service.ITbInvoiceRequestsService;
import com.ruoyi.system.vo.InvoiceListVo;
/**
 * 发票申请Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-04-26
 */
@Service
public class TbInvoiceRequestsServiceImpl implements ITbInvoiceRequestsService 
{
    @Autowired
    private TbInvoiceRequestsMapper tbInvoiceRequestsMapper;

    /**
     * 查询发票申请
     * 
     * @param id 发票申请主键
     * @return 发票申请
     */
    @Override
    public TbInvoiceRequests selectTbInvoiceRequestsById(Long id)
    {
        return tbInvoiceRequestsMapper.selectTbInvoiceRequestsById(id);
    }

    /**
     * 查询发票申请列表
     * 
     * @param tbInvoiceRequests 发票申请
     * @return 发票申请
     */
    @Override
    public List<TbInvoiceRequests> selectTbInvoiceRequestsList(TbInvoiceRequests tbInvoiceRequests)
    {
        return tbInvoiceRequestsMapper.selectTbInvoiceRequestsList(tbInvoiceRequests);
    }

    /**
     * 新增发票申请
     * 
     * @param tbInvoiceRequests 发票申请
     * @return 结果
     */
    @Override
    public int insertTbInvoiceRequests(TbInvoiceRequests tbInvoiceRequests)
    {
        tbInvoiceRequests.setCreateTime(DateUtils.getNowDate());
        return tbInvoiceRequestsMapper.insertTbInvoiceRequests(tbInvoiceRequests);
    }

    /**
     * 修改发票申请
     * 
     * @param tbInvoiceRequests 发票申请
     * @return 结果
     */
    @Override
    public int updateTbInvoiceRequests(TbInvoiceRequests tbInvoiceRequests)
    {
        tbInvoiceRequests.setUpdateTime(DateUtils.getNowDate());
        return tbInvoiceRequestsMapper.updateTbInvoiceRequests(tbInvoiceRequests);
    }

    /**
     * 批量删除发票申请
     * 
     * @param ids 需要删除的发票申请主键
     * @return 结果
     */
    @Override
    public int deleteTbInvoiceRequestsByIds(Long[] ids)
    {
        return tbInvoiceRequestsMapper.deleteTbInvoiceRequestsByIds(ids);
    }

    /**
     * 删除发票申请信息
     * 
     * @param id 发票申请主键
     * @return 结果
     */
    @Override
    public int deleteTbInvoiceRequestsById(Long id)
    {
        return tbInvoiceRequestsMapper.deleteTbInvoiceRequestsById(id);
    }

    @Override
    public Object queryTheInvoicingStatistics(Long userId) {
        return this.tbInvoiceRequestsMapper.queryTheInvoicingStatistics(userId);
    }

    @Override
    public List<InvoiceListVo> queryOrderThatCanBeInvoiced(Long userId) {
        return this.tbInvoiceRequestsMapper.queryOrderThatCanBeInvoiced(userId);
    }
}
